home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1999 March
/
EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso
/
earcd
/
-archivi
/
-recent2
/
arexxcomm.lha
/
ARexxComm-S.e
< prev
next >
Wrap
Text File
|
1999-03-21
|
2KB
|
48 lines
/* ARexxComm-S - use in conjunction with ARexxComm-R */
MODULE 'CSH/arexxcomm'
PROC main()
DEF portinfo=NIL:PTR TO rxcom, portname=NIL:PTR TO CHAR, toport=NIL:PTR TO CHAR,
wasack=FALSE, command:PTR TO CHAR, args:PTR TO CHAR
portname:='TestHost'; toport:='ExampleHost'
NEW portinfo.createPort(portname,{portinfo})
IF portinfo
WriteF('Sent "SAYYO TestHost"\n')
IF (portinfo.sendRexxMsg(toport,'SAYYO TestHost'))=FALSE THEN WriteF('Could not be recieved!\n')
Delay(50)
WriteF('Sent "SAYHI"\n')
IF (portinfo.sendRexxMsg(toport,'SAYHI'))=FALSE
WriteF('Could not be recieved!\n')
ELSE
/* crude example of waiting to hear our message was understood - ignores all other messages (bad in real program) */
WriteF('We have \d messages not yet acknowledged.\n',portinfo.howManyAcksLeft())
WriteF('\nWaiting to be told our message was recieved...\n')
REPEAT
command,args,wasack:=portinfo.waitForRexxMsg(TRUE)
IF command THEN portinfo.ackRexxMsg(TRUE) ->if get any real message then claim to know what it means (don't do in real programs!)
IF wasack THEN WriteF('Recieved acknowledgement!\n')
UNTIL portinfo.howManyAcksLeft()=0
WriteF('\nWe have \d messages not yet acknowledged.\n',portinfo.howManyAcksLeft())
ENDIF
Delay(50)
WriteF('Sent "Unknown"\n')
IF (portinfo.sendRexxMsg(toport,'Unknown'))=FALSE THEN WriteF('Could not be recieved!\n')
Delay(150)
WriteF('We have \d messages not yet acknowledged.\n',portinfo.howManyAcksLeft())
WriteF('Sent "QUIT"\n')
IF (portinfo.sendRexxMsg(toport,'QUIT'))=FALSE THEN WriteF('Could not be recieved!\n')
WriteF('We have \d messages not yet acknowledged.\n',portinfo.howManyAcksLeft())
WriteF('Waiting to recieve a message (can use Ctrl-C)!\n')
portinfo.waitForRexxMsg()
WriteF('We have \d messages not yet acknowledged.\n',portinfo.howManyAcksLeft())
END portinfo
ENDIF
ENDPROC